/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package demo.collection;

import java.util.Scanner;

/**
 *
 * @author VANDH
 */
public class Hotel implements Comparable {

    String hotelName;
    String ownerName;
    String location;
    double tariff;

    // Constructor
    public Hotel() {
        hotelName = "";
        ownerName = "";
        location = "";
        tariff = 0;
    }

    public Hotel(String hotelName, String ownerName, String location) {
        this.hotelName = hotelName;
        this.ownerName = ownerName;
        this.location = location;
    }

    // Method
    public void inputHotel() {
        Scanner keyboard = new Scanner(System.in);

        System.out.printf("Hotel name : ");
        this.hotelName = keyboard.nextLine();
        System.out.printf("Owner name : ");
        this.ownerName = keyboard.nextLine();
//        System.out.printf("Location : ");
//        this.location = keyboard.nextLine();
//        System.out.printf("Tariff : ");
//        this.tariff = keyboard.nextDouble();
    }

    public void showHotel() {
        System.out.println(
                hotelName + ", " + ownerName
                + ", " + location + ", " + tariff);
    }

    @Override
    public String toString() {
        return hotelName + ", " + ownerName;
    }

    @Override
    public int compareTo(Object o) {
        Hotel h = (Hotel) o;
        if (this.hotelName.length() < h.hotelName.length()) {
            return -1;
        } else if (this.hotelName.length() > h.hotelName.length()) {
            return 1;
        }
        return 0;
    }
}
